/*******************************************************************************
*   			Impacts of a Large-Scale Parenting Program: 				   *
*					Experimental Evidence from Chile						   *
********************************************************************************


	REQUIRES:	"$dt_int/baseline_for figures.dta"
	CREATES:	${out_tables}/F3A_base_parentbeh_caregiver.eps
				
	WRITEN BY:  Italo Lopez  [italolop@usc.edu]

********************************************************************************
	Prepare data
*******************************************************************************/

	* Load data
	use "$dt_int/baseline_for figures.dta", clear



/*******************************************************************************
*   Set macros for regressions
*******************************************************************************/
	
	* Var labels 
	
	* Plot settings 
	*--------------------------------- 
	set scheme white_tableau
	graph set window fontface "Times New Roman"
	global graph_pref "graphregion(color(white) margin(vsmall)) "

/*******************************************************************************
Figure A3: Baseline parenting behaviors and primary caregiver education
*******************************************************************************/


gen  PBC_Dicipl_old= PBC_Dneg_old + PBC_Dpos_old + PBC_Dmakefeel_old

** PBC vs Educ **
twoway (lowess PBC_Nurtur_old pc_yrsch_old if inrange(edadtramos,1,6), lcolor(black) ) 		/*
*/ (lowess PBC_Dicipl_old pc_yrsch_old if inrange(edadtramos,1,6), lcolor(black) lpattern(dash)), 			/*
*/ ytitle("PBC score", size(medium)) 														/*
*/ xtitle("Primary Caregiver Years of Schooling", size(medium)) 							/*
*/ xlabel(0(5)25, valuelabel nogrid) 	name(F3A_a, replace) 	ylab(,nogrid) 							/*
*/ title("a. PBC vs Caregiver Education", size(medlarge)) 										/*
*/ legend(lab(1 "PBC Nurturing") lab(2  "PBC Discipline") pos(6)) /*
*/ ytitle("PBC raw score")



** FCI vs Educ **
twoway (kdensity fci_bin_pv_old if pc_edu_old==1, kernel(gaussian) lcolor(black) ) /*
*/ (kdensity fci_bin_pv_old  if pc_edu_old==2, kernel(gaussian) lcolor(black) lpatter(longdash)) /*
*/ (kdensity fci_bin_pv_old  if pc_edu_old==3, kernel(gaussian) lcolor(black) lpatter(dot) lwidth(.5)) /* 
*/ (kdensity fci_bin_pv_old if pc_edu_old==4, kernel(gaussian) lcolor(black) lpatter(shortdash)), /* 
*/ ytitle("kdensity", size(medium)) xtitle("FCI IRT estimate", size(medium)) /* 
*/ ylabel(, nogrid) xlabel(, valuelabel nogrid) name(F3A_b, replace) /*
*/ title("b. Home environment (FCI) by caregiver education", size(medlarge)) /*
*/ legend(lab(1 "Primary") lab(2  "HS Dropout") lab(3  "HS Degree") lab(4  "Tertiary") pos(6) rows(2)) /*
*/ ytitle("Probability density of FCI IRT score")

	graph combine F3A_a F3A_b, rows(1) xsize(8)
	gr export "$out_graphs/appendix/F3A_base_parentbeh_caregiver.eps", replace
	gr export "$out_graphs/appendix/F3A_base_parentbeh_caregiver.wmf", replace 
	gr export "$out_graphs/appendix/F3A_base_parentbeh_caregiver.png", replace 

